<?php
namespace app\admin\model;

class SysUser extends \think\Model
{
    public function getLogInfo($username)
    {
        return  $this->field('id,username,password,salt,login_time, login_ip')->where('username', $username)->find();
    }

    public function getUsernames($role_id = null)
    {
        if ($role_id == null) {
            return $this->column('id, username');
        } else {
            $data = $this->where('role_id', $role_id)->column('username');

            if ($data) {
                return implode(',', $data);
            } else {
                return null;
            }
        }
    }
}
